package com.zhy.springcloud.controller;

import com.zhy.springcloud.enetities.CommonResult;
import com.zhy.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author zhy
 * @Description 消费者控制层
 * @ClassName OrderController
 * @Date 2020/12/3 15:37
 **/
@RestController
@Slf4j
public class OrderController {


    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<com.zhy.springcloud.entities.Payment> getPaymentById(@PathVariable("id") long id){
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping("/consumer/feign/timeout")
    public String paymentFeignTimeOut(){
        //openfeign-ribbon，客户端一般等待1秒
        return paymentFeignService.paymentFeignTimeOut();
    }

}
